/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function(height) {
    let result=0;
    let left=0;
    let right=height.length-1;
    while(left!=right){
        result=Math.max(Math.min(height[left],height[right])*(right-left),result)
        if(height[left]>height[right]){
            right--;
        }else{
            left++;
        }
    }
    
    return result
};